package com.example.demo;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class PrxoyDemo {
    public static void main(String[] args) {
        Test test=(Test) Prxoy.newProxyInstance(PrxoyDemo.class.getClassLoader()),
                new Class[]{
                        Test.class
                },new InvocationHandler(){
                    Test target=new TestImpl();

                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        System.out.println(method.getName() + "被调用");

                        return method.invoke(target,args);
                    }
                });
        System.out.println(test.hai("ni hao"));
    }
    public static class  TestImplProxy extends TestImpl{
        public String hai(String name){

        }
    }


}
